#-*-coding:utf-8-*-
import hou
class SaveAndLoadOptions(object):
    def __init__(self):
        super(SaveAndLoadOptions,self).__init__()

    def setSceneSave_SaveMethod(self,methodNum):
        '''
        :param methodNum: 0 - Overwrite File, 1 - Increment Filename,
        2 - Make Numbered Backup,
        :return:
        '''
        hou.setPreference('general.inc.val', str(methodNum))
        # print('setSceneSave_SaveMethod')

    def getSceneSave_SaveMethod(self):
        return hou.getPreference('general.inc.val')
        # print('getSceneSave_SaveMethod')


    def setSceneSave_SaveViewCommandsFor(self,commandNum):
        '''
        :param commandNum: 0 - All Viewers ,1 - Existing Viewers,
        2 - Open Viewers
        :return:
        '''
        hou.setPreference('general.saveviewcmds.val', str(commandNum))
        # print('setSceneSave_SaveViewCommandsFor')


    def getSceneSave_SaveViewCommandsFor(self):
        return hou.getPreference('general.saveviewcmds.val')
        # print('getSceneSave_SaveViewCommandsFor')



    def setSceneSave_SaveNewFilesAs(self,asNum):
        '''
        :param asNum: 0 - Binary, 1 - Text
        :return:
        '''
        hou.setPreference('general.newfilesavesceneformat.val', str(asNum))
        # print('setSceneSave_SaveNewFilesAs')

    def getSceneSave_SaveNewFilesAs(self):
        return hou.getPreference('general.newfilesavesceneformat.val')
        # print('getSceneSave_SaveNewFilesAs')


    def setAutoSaveEvery(self,value):
        hou.setPreference('general.autosaveinterval.val',str(value))
        # print('setAutoSaveEvery')

    def getAutoSaveEvery(self):
        return hou.getPreference('general.autosaveinterval.val')
        # print('getAutoSaveEvery')


    def setAutoSaveMethod(self,methodNum):
        '''
        :param methodNum: 0 - Overwrite File, 1 - Increment Filename ,
        2 - Make Numbered Backup
        :return:
        '''
        hou.setPreference('general.autosaveinc.val',str(methodNum))


    def getAutoSaveMethod(self):
        return hou.getPreference('general.autosaveinc.val')
        # print('getAutoSaveMethod')



    def setSceneLoad_WarnAboutDeprecatedOperators(self,bool):
        if bool == True:
            hou.setPreference('general.loadwarndeprecated.val','1')
            # print('1')
        else:
            hou.setPreference('general.loadwarndeprecated.val','0')
            # print('0')


    def getSceneLoad_WarnAboutDeprecatedOperators(self):
        return hou.getPreference('general.loadwarndeprecated.val')
        # print('getSceneLoad_WarnAboutDeprecatedOperators')
